<%- include('../public/page_header.html')%>

<div class="panel panel-default">
    <div class="panel-heading">
        增加管理员
    </div>
    <div class="panel-body">
        <div class="table-responsive input-form">
            <form action="/<%=adminPath%>/manager/doAdd" method="post" id="form">
                <ul>
                    <li><span>管理员名称：</span><input type="text" name="username" id="username"/></li>
                    <li><span>管理员密码：</span><input type="password" name="password" id="password"/></li>
                    <li><span>确认密码：</span><input type="password" name="rpassword" id="rpassword"/></li>
                    <li><span>管理员电话：</span><input type="text" name="mobile" id="mobile"/></li>
                    <li><span>管理员邮箱：</span><input type="text" name="email" id="email"/></li>
                    <li>
                        <span>状态：</span>
                        <input type="radio" name="status" checked value="1" id="a"><label for="a">显示</label>
                        <input type="radio" name="status" value="0" id="b"><label for="b">隐藏</label>
                    </li>
                    <li>
                        <div class="error"></div>
                        <br />
                        <button type="submit" class="btn btn-default" id="submitBtn">提交</button>
                    </li>

                </ul>


            </form>
        </div>
    </div>
</div>
</body>
<script>
    $('#form').submit(()=>{
        let username = $('#username').val();
        let password = $('#password').val();
        let rpassword = $('#rpassword').val();

        if(username.length == 0){
            $('.error').html('Error：用户名不能为空');
            return false;
        }
        if(password.length < 6){
            $('.error').html('Error：密码长度不能小于6位');
            return false;
        }
        if(password != rpassword){
            $('.error').html('Error：密码和确认密码不一致');
            return false;
        }
        $('.error').html('');
        return true;
    })
</script>

</html>